package com.cq.hd.order.controller;

import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.order.api.TbMonthSettleBillApi;
import com.cq.hd.order.api.dto.MonthSettleBillWithdrawalDto;
import com.cq.hd.order.api.vo.MonthSettleBillVo;
import com.cq.hd.order.service.TbMonthSettleBillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 月度结算单 前端控制器
 * </p>
 *
 * @author mYunYu
 * @since 2024-01-23
 */
@RestController
public class TbMonthSettleBillController implements TbMonthSettleBillApi {
    @Autowired
    private TbMonthSettleBillService monthSettleBillService;

    @Override
    public Result<List<MonthSettleBillVo>> getMerchantWaitMonthSettleBill(Long merchantId, Integer type) {
        return ResultGenerator.success(monthSettleBillService.getMerchantWaitMonthSettleBill(merchantId, type));
    }

    @Override
    public Result<List<MonthSettleBillVo>> getAvailableMonthSettleBillByIds(Long merchantId, List<Long> ids) {
        return ResultGenerator.success(monthSettleBillService.getAvailableMonthSettleBillByIds(merchantId, ids));
    }

    @Override
    public Result<Integer> withdrawalByDto(List<MonthSettleBillWithdrawalDto> monthSettleBillWithdrawalDtos) {
        return ResultGenerator.success(monthSettleBillService.withdrawalByDto(monthSettleBillWithdrawalDtos));
    }

    @Override
    public Result<Boolean> withdrawalUpdateStatus(Long withdrawalId, Integer auditState) {
        return ResultGenerator.success(monthSettleBillService.withdrawalUpdateStatus(withdrawalId, auditState));
    }

    @Override
    public Result<Boolean> executeMonthlySettlement() {
        monthSettleBillService.executeMonthlySettlement();
        return ResultGenerator.success(true);
    }

    @Override
    public Result<Boolean> executeMerchantAmtSettlement() {
        monthSettleBillService.executeMerchantAmtSettlement();
        return ResultGenerator.success(true);
    }

}
